package mq

import (
	"charging_pile/util/protocol/jiuxing"

	"github.com/zeromicro/go-zero/core/logx"
)

func handle23(nc *natsClient, in *jiuxing.Package) (jxMsg *jiuxing.Package) {
	msg := jiuxing.Msg23{}
	msg.Decode(in.Payload)
	logx.Infof("msg23:%+v", msg)

	defer func() {
		resp := jiuxing.Msg24{}
		jxMsg = &jiuxing.Package{
			Cmd:        byte(0x24),
			Sn:         in.Sn,
			Encryption: in.Encryption,
			PackageLen: 0,
			Payload:    []uint8{},
			Check:      0,
		}
		resp.Tm = formatJxTime()
		resp.Plug = msg.Plug
		resp.RecordSn = msg.RecordSn
		jxMsg.Payload = resp.Encode()
		jxMsg.PackageLen = uint16(len(jxMsg.Payload))
	}()
	return
}

func init() {
	HandlerMap[uint8(0x23)] = handle23
}
